package com.eimf.saf.security.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eimf.saf.security.dao.OrganizeOperationLogDao;
import com.eimf.saf.security.entity.OrganizeOperationLogDTO;
import com.eimf.saf.security.service.OrganizeOperationLogService;

/**
 * @author eden
 * @date 2013-11-27 上午10:41:19
 * @Description: TODO(这里用一句话描述这个类的作用)
 */
@Service
public class OrganizeOperationLogServiceImpl implements OrganizeOperationLogService
{

    @Autowired
    private OrganizeOperationLogDao operationLogDao;

    @Override
    public void addLogSelfEvent(final HashMap<String, Object> param)
    {
        param.put("guestId", param.get("masterId"));
        log(param);
    }

    @Override
    public void addLogAdminEvent(final HashMap<String, Object> param)
    {
        log(param);
    }

    public void logSystemEvent(final HashMap<String, Object> param)
    {
        param.put("masterId", "SAF");
        log(param);
    }

    private void log(final HashMap<String, Object> param)
    {
        operationLogDao.addLog(param);
    }

    @Override
    public int findPasswordErrorTimesByStaffId(final String staffId)
    {
        return this.operationLogDao.findPasswordErrorTimes(staffId);
    }

    @Override
    public List<OrganizeOperationLogDTO> findLog(final HashMap<String, Object> param)
    {
        return operationLogDao.findLog(param);
    }

}
